package com.tepth.appmanageservice.tools.ext;

import com.tepth.appmanageservice.protocol.Index;

import java.util.Calendar;
import java.util.Date;

public class ExtToDate {
	public static Date fromByteArray(byte[] data, Index index) {
		int y = 2000 + ExtToInt.dateTimeConverter(data[index.get()]);

		int M = ExtToInt.dateTimeConverter(data[index.get()]);
		int d = ExtToInt.dateTimeConverter(data[index.get()]);
		int H = ExtToInt.dateTimeConverter(data[index.get()]);
		int m = ExtToInt.dateTimeConverter(data[index.get()]);
		int s = ExtToInt.dateTimeConverter(data[index.get()]);

		Calendar c = Calendar.getInstance();
		c.set(y, M, d, H, m, s);
		return c.getTime();
	}
}